package homework;

import lesson.Util;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Login  extends JPanel implements ActionListener {
    private Atm atm;
    private Icon ldBtnImg = Util.getIcon("/buttonLand.jpg");
    private Icon loginimg = Util.getIcon("/buttonLogin.jpg");
    private JButton  landBtn = new JButton(ldBtnImg);
    private JButton  loginBtn = new JButton(loginimg);


    public Login ( Atm atm ){
        this.atm = atm;
        landBtn.setBounds(930,400,140,50);
        landBtn.addActionListener(this);
        loginBtn.setBounds(930,500,140,50);
        this.add(landBtn);
        this.add(loginBtn);
        this.setLayout(null);
        this.setOpaque(false);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==landBtn){
            System.out.println("11111");
            atm.switchPanel("menu");
        }

    }
}
